package com.eagledata.project.business.petServiceInstance.service;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.eagledata.common.utils.StringUtil;
import com.eagledata.project.business.petServiceInstance.mapper.PetServiceInstanceMapper;
import com.eagledata.project.business.petServiceInstance.domain.PetServiceInstance;
import com.eagledata.project.business.petServiceInstance.service.IPetServiceInstanceService;

/**
 * 宠物服务实例 服务层实现
 * 
 * @author eagledata
 * @date 2018-09-09
 */
@Service
public class PetServiceInstanceServiceImpl implements IPetServiceInstanceService 
{
	@Autowired
	private PetServiceInstanceMapper petServiceInstanceMapper;
	
	/**
     * 查询宠物服务实例信息
     * 
     * @param id 宠物服务实例ID
     * @return 宠物服务实例信息
     */
	 @Override
	public PetServiceInstance selectPetServiceInstanceById(Long id) {
	    return petServiceInstanceMapper.selectPetServiceInstanceById(id);
	}
	
	/**
     * 查询宠物服务实例列表
     * 
     * @param petServiceInstance 宠物服务实例信息
     * @return 宠物服务实例集合
     */
	 @Override
	public List<PetServiceInstance> selectPetServiceInstanceList(PetServiceInstance petServiceInstance) {
	    return petServiceInstanceMapper.selectPetServiceInstanceList(petServiceInstance);
	}
	
    /**
     * 新增宠物服务实例
     * 
     * @param petServiceInstance 宠物服务实例信息
     * @return 结果
     */
	 @Override
	public int insertPetServiceInstance(PetServiceInstance petServiceInstance) {
	    return petServiceInstanceMapper.insertPetServiceInstance(petServiceInstance);
	}
	
	/**
     * 修改宠物服务实例
     * 
     * @param petServiceInstance 宠物服务实例信息
     * @return 结果
     */
	 @Override
	public int updatePetServiceInstance(PetServiceInstance petServiceInstance) {
	    return petServiceInstanceMapper.updatePetServiceInstance(petServiceInstance);
	}
	
	/**
     * 保存宠物服务实例
     * 
     * @param petServiceInstance 宠物服务实例信息
     * @return 结果
     */
	 @Override
	public int savePetServiceInstance(PetServiceInstance petServiceInstance) {
	    Long id = petServiceInstance.getId();
		int rows = 0;
		if (StringUtil.isNotNull(id)) {
		    rows = petServiceInstanceMapper.updatePetServiceInstance(petServiceInstance);
		} else {
		    rows = petServiceInstanceMapper.insertPetServiceInstance(petServiceInstance);
		}
		return rows;
	}
	
	/**
     * 删除宠物服务实例信息
     * 
     * @param id 宠物服务实例ID
     * @return 结果
     */
	 @Override
	public int deletePetServiceInstanceById(Long id) {
	    return petServiceInstanceMapper.deletePetServiceInstanceById(id);
	}
	
	/**
     * 批量删除宠物服务实例对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
	 @Override
	public int batchDeletePetServiceInstance(Long[] ids) {
		return petServiceInstanceMapper.batchDeletePetServiceInstance(ids);
	}
	
}
